//
//  AttentionTableViewCell.m
//  LoveAttention
//
//  Created by 鞠超 on 15/12/30.
//  Copyright © 2015年 JC. All rights reserved.
//

#import "AttentionTableViewCell.h"

@implementation AttentionTableViewCell

- (instancetype )initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if(self)
    {
        [self p_setupView];
    }
    return self;
}

- (void)p_setupView
{
    self.image = [[UIImageView alloc] init];
//    self.image.backgroundColor = [UIColor orangeColor];
    self.image.image = [UIImage imageNamed:@"头像"];
    [self.contentView addSubview:self.image];
    
    self.name = [[UILabel alloc] init];
    self.name.text = @"wolaji";
//    self.name.backgroundColor = [UIColor orangeColor];
    [self.contentView addSubview:self.name];
    
    self.detail = [[UILabel alloc] init];
    self.detail.text = @"爱生活， 爱生活， 爱生活， 爱生活， 爱生活";
    self.detail.font = [UIFont systemFontOfSize:10];
    self.detail.textColor = [UIColor grayColor];
    [self.contentView addSubview:self.detail];
    
    self.date = [[UILabel alloc] init];
    self.date.text = @"2015-11-12";
    self.date.font = [UIFont systemFontOfSize:11];
    [self.contentView addSubview:self.date];
    
    self.image_right = [[UIImageView alloc] init];
    self.image_right.image = [UIImage imageNamed:@"字体后面的箭头"];
    [self.contentView addSubview:self.image_right];
}

- (void)layoutSubviews
{
    [super layoutSubviews];
    
    self.image.frame = CGRectMake(15, 10, 55, 55);
    self.image.layer.cornerRadius = 55/2;
    
    self.name.frame = CGRectMake(CGRectGetMaxX(self.image.frame) + 7, CGRectGetMinY(self.image.frame), self.contentView.frame.size.width - 35 - CGRectGetMaxX(self.image.frame) - 7, 20);
    
    self.detail.frame = CGRectMake(CGRectGetMaxX(self.image.frame) + 7, CGRectGetMaxY(self.name.frame) + 3, self.contentView.frame.size.width - 35 - CGRectGetMaxX(self.image.frame) - 7, 15);
    
    self.date.frame = CGRectMake(CGRectGetMaxX(self.image.frame) + 7, CGRectGetMaxY(self.detail.frame) + 3, self.contentView.frame.size.width - 35 - CGRectGetMaxX(self.image.frame) - 7, 15);
    
    self.image_right.frame = CGRectMake(self.contentView.frame.size.width - 10 - 25, 20, 25, 30);
}












@end
